package com.lagou.rocketmq.controller;

import com.lagou.rocketmq.service.GoodService;
import com.lagou.rocketmq.service.OrdersService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OrderController {

    @Resource
    private GoodService goodService;
    @Resource
    private OrdersService ordersService;

    @GetMapping("placeOrder")
    public String placeOrder(@RequestParam("userId") int userId, @RequestParam("goodId") int goodId) {
        goodService.placeOrder(userId, goodId);
        return "true";
    }

    @GetMapping("pay")
    public void placeOrder(@RequestParam("ordersId") int ordersId) {
        ordersService.pay(ordersId);
    }

}
